<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
  </style>
</head>

<body>
  <input type="button" value="删除">
  <ul>
    <li>haodele</li>
  </ul>
</body>
<script>
  // 获取元素
  let ul = document.querySelector("ul");
  // 删除元素
  // node.removeChild(child);
  document.querySelector("input").addEventListener("click", (e) => {
    if (ul.children.length == 0) {
      e.currentTarget.disabled = true;
    } else {
      ul.removeChild(ul.children[0]);
    };
  });
</script>

</html>